<template>
  <tr>
    <td>
      <input type="checkbox" v-model="obj.checked" />
    </td>
    <td>{{ obj.name }}</td>
    <td>{{ obj.price }}</td>
    <td>
      <button @click="addBtn">+</button>
      {{ obj.num }}
      <button @click="reBtn">-</button>
    </td>
    <td>{{ obj.num * obj.price }}</td>
    <td><button @click="clsBtn">删除</button></td>
  </tr>
</template>

<script>
export default {
  name: '',
  components: {},
  props: ['obj', 'ind'],
  data() {
    return {}
  },
  computed: {},
  watch: {},
  created() {},
  methods: {
    addBtn() {
      this.obj.num++
    },
    reBtn() {
      this.obj.num > 1 ? this.obj.num-- : (this.obj.num = 1)
    },
    clsBtn() {
      this.$emit('removeBtn', this.index)
    },
  },
}
</script>

<style scoped></style>